﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using StructureMap;

namespace DBMigrator.Core.DbObjects.Data.Where
{
    public class WhereColumn<T> : IWhereColumn<T>
    {
        private readonly string columnName;
        
        public IWhereComparison Comparison { get; private set; }
        public IWhereCondition NextCondition { get; private set; }
        
        public WhereColumn(IWhereCondition nextCondition, string columnName)
        {
            NextCondition = nextCondition;
            this.columnName = columnName;
        }

        public IWhereCondition IsEqualTo(T value)
        {
            Comparison = ObjectFactory.With("columnName").EqualTo(columnName).With("op")
                .EqualTo(WhereColumnComparisonOperators.EqualTo).With("value").EqualTo(value)
                .GetInstance<IWhereComparison>();

            return NextCondition;
        }
    }
}
